<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<%@include file="../common/selfCss.jsp"%>
<script type="text/javascript">
	function updateRoleResource(roleId) {
		var arrResourceList = new Array();
		$(":checkbox[name='CheckboxGroup1']").each(function() {
			if ($(this).attr("checked")) {
				arrResourceList.push($(this).attr("alt"));
			}
		});
		$.ligerDialog.confirm('你确认修改权限吗？', 
				function (yes){
					if(yes){
						$.post("/misc/admin/updateRoleResource.htm", {
							arrResourceList : $.toJSON(arrResourceList),
							roleId : "${roleId}"
						}, function(data) {
							if(data=='success'){
								parent.$.ligerDialog.success("修改成功！");
								parent.roleDialog.close();
							}else{
								$.ligerDialog.warn("系统有点抽经，请稍候重试！");
							}
						});
					}
				});
		
	}

</script>
<table width="100%" class="def_t">
	<c:forEach items="${resources}" var="resource">
	<tr>
		<td><input type="checkbox" name="CheckboxGroup1" alt="${resource.id}" <c:if test="${resource.isResource }">checked="checked"</c:if>/>${resource.name} </td>
	</tr>
	</c:forEach>
	<tr>
		<td>
			<button onclick='javascript:parent.roleDialog.close();'>关闭</button>
			<button onclick="updateRoleResource()">确定</button>
		</td>
	</tr>
</table>
